import { PrimaryColumn , Column, Entity, OneToMany } from 'typeorm';
import { User } from './user';

@Entity()
class Role {

    @PrimaryColumn()
    id: number;

    @Column({
        type: "varchar",
        length: 255,
        nullable: false,
    })
    name: string;

    @Column({
        type: "varchar",
        length: 255,
        nullable: false,
        unique: true,
    })
    value: string;

    @Column({
        type: "varchar",
        length: 255,
        nullable: false,
    })
    permission: string;

    @OneToMany(type => User, user => user.role)
    user: User;
}

export { Role }